package com.example.demo.service.query.impl;

import clover.org.apache.commons.collections.IteratorUtils;
import com.example.demo.model.Clazz;
import com.example.demo.model.QClazz;
import com.example.demo.repository.ClazzRepository;
import com.example.demo.service.query.ClassQuerySerivce;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.BooleanExpression;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lafengmaker
 * @title: ClassQuerySerivceImpl
 * @projectName demo
 * @description: 　单测
 * @email yeweijun@souche.com
 * @date 2019-10-10 15:36
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class ClassQuerySerivceImpl implements ClassQuerySerivce {
    private final ClazzRepository clazzRepository;
    @Override
    public List<Clazz> selectallClazzByName() {
        QClazz clazz=QClazz.clazz;
        Predicate predicate=clazz.name.like("%初%");
        Iterable<Clazz> clazzes=clazzRepository.findAll(predicate);
        return IteratorUtils.toList(clazzes.iterator());
    }
}
